<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base target="_self">
    <title>新增学童</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="新增,学童">
	<meta http-equiv="description" content="This is my page">

	<style type="text/css">
	</style>

  </head>
  
  <body>
    <center>
    	<s:form name="frm" id="frm" method="post" action="" namespace="">
    		<jsp:include page="/jsp/outward/business/common/menuLink.jsp">
    			<jsp:param name="menuLink" value="[{'name':'公共管理'},{'name':'学童管理'},{'name':'新增学童'}]"/>
    			<jsp:param name="width" value="70%"/>
    		</jsp:include>
    		
    		<s:hidden name="parentMethod" id="parentMethod"></s:hidden>
    		<s:hidden name="isMd" id="isMd"></s:hidden>
    		<s:hidden name="kindergartenId" id="kindergartenId"></s:hidden>
    		
    		<table width="100%" cellspacing="1" cellpadding="3" bgcolor="#CCCCCC">
    			<tr bgcolor="#FFFFFF">
    				<td width="20%" align="right" class="label">
    					编号：
    				</td>
    				<td width="30%" align="left">
    					待保存
    				</td>
    				<td width="20%" align="right" class="label">
    					学童姓名：
    					<br>
    					<font color="red">(20字以内)</font>
    				</td>
    				<td width="30%" align="left">
    					<s:textfield name="child.childName" id="childName" cssStyle="width:90%" maxlength="20"></s:textfield>
    				</td>
    			</tr>
    			<tr bgcolor="#FFFFFF">
    				<td align="right" class="label">
    					性别：
    				</td>
    				<td align="left">
    					<s:select list='#{"男":"男", "女":"女"}' name="child.sex" id="sex" cssStyle="width:90%"></s:select>
    				</td>
    				<td align="right" class="label">
    					所属班级：
    				</td>
    				<td align="left">
    					<s:select list="classList" name="child.cla.id" id="classId" listKey="id" listValue="className" headerKey="" headerValue="--请选择--" cssStyle="width:90%"></s:select>
    				</td>
    			</tr>
    			<tr bgcolor="#FFFFFF">
    				<td align="right" class="label">
    					生日：
    				</td>
    				<td align="left">
    					<s:textfield name="child.birthday" id="birthday" cssStyle="width:90%" cssClass="WDate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"></s:textfield>
    				</td>
    				<td align="right" class="label">
    					入学时间：
    				</td>
    				<td align="left">
    					<s:textfield name="child.entranceTime" id="entranceTime" cssStyle="width:90%" cssClass="WDate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"></s:textfield>
    				</td>
    			</tr>
    			<tr bgcolor="#FFFFFF">
    				<td align="right" class="label">
    					家长：
    					<br>
    					<font color="red">(20字以内)</font>
    				</td>
    				<td align="left">
    					<s:textfield name="child.parent" id="parent" cssStyle="width:90%" maxlength="20"></s:textfield>
    				</td>
    				<td align="right" class="label">
    					联系电话：
    					<br>
    					<font color="red">(20字以内)</font>
    				</td>
    				<td align="left">
    					<s:textfield name="child.phone" id="phone" cssStyle="width:90%" maxlength="20"></s:textfield>
    				</td>
    			</tr>
    			<tr bgcolor="#FFFFFF">
    				<td align="right" class="label">
    					地址：
    					<br>
    					<font color="red">(25字以内)</font>
    				</td>
    				<td align="left" colspan="3">
    					<s:textfield name="child.address" id="address" cssStyle="width:95%" maxlength="25"></s:textfield>
    				</td>
    			</tr>
    			<tr bgcolor="#FFFFFF">
    				<td align="right" class="label">
    					户籍信息：
    					<br>
    					<font color="red">(10字以内)</font>
    				</td>
    				<td align="left">
    					<s:textfield name="child.residence" id="residence" cssStyle="width:90%" maxlength="10"></s:textfield>
    				</td>
    				<td align="right" class="label">
    					是否在读：
    				</td>
    				<td align="left">
    					<s:select list='#{1:"是",0:"否"}' name="child.status" cssStyle="width:60px;"></s:select>
    				</td>
    			</tr>
    		</table>
    		
    		<table width="100%" cellspacing="0">
    			<tr>
    				<td align="center" valign="bottom" height="30">
    					<input type="button" value="新增" class="btn" onclick="addChild()" />
    				</td>
    			</tr>
    		</table>
    		
    		
    	</s:form>
    </center>
    
    <script type="text/javascript">
    function addChild()
    {
    	var childName = $('#childName');
    	var classId = $('#classId');
    	var birthday = $('#birthday');
    	var entranceTime = $('#entranceTime');
    	if(!isNotNull(childName.val()))
    	{
    		showMsg('学童姓名不能为空。', function(){childName.focus();});
    		return;
    	}
    	if(!isNotNull(classId.val()))
    	{
    		showMsg('所属班级不能为空。', function(){classId.focus();});
    		return;
    	}
    	var url = 'inner/common/addChild.action';
    	ajaxAction(url, 'post', 'frm', true, function(result){
    		var parentMethod = $('#parentMethod');
    		if(isNotNull(parentMethod.val()))
    		{
    			var isMd = $('#isMd');
    			if('Y' == isMd.val() || '1' == isMd.val())
    			{
    				eval('parent.window.dialogArguments.' + parentMethod.val() + '();');
    			}
    			else
    			{
    				eval('window.opener.' + parentMethod.val() + '();');
    			}
    		}
    		window.close();
    	});
    }
    </script>
  </body>
</html>
